package com.xin.ruanjian.omsystem.utils;

import android.content.Context;

import com.xin.ruanjian.omsystem.app.MyApplication;

/**
 * Created by local123 on 2018/2/10.
 */

public class DpPxUtils {
    /**
     * dp转px
     *
     * @param dpValue dp
     * @return int px
     * @throws
     */
    public static int dp2px(float dpValue) {
        return (int) (dpValue * MyApplication.getDensity() + 0.5f);
    }

    /**
     * px 转 dp
     *
     * @param pxValue px
     * @return int dp
     * @throws
     */
    public static int px2dp(float pxValue) {
        return (int) (pxValue / MyApplication.getDensity() + 0.5f);
    }
}
